package com.briup.estore.common.util;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.security.SecureRandom;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@Component
public class PasswordEncoder   {
	public PasswordEncoder(){
		this(-1);
	}

	public PasswordEncoder(int strength){

	}


	public boolean upgradeEncoding(String encodedPassword) {
		return false;
	}

	//进行md5加密
	public String encode(CharSequence charSequence) {
		return MD5.encrypt(charSequence.toString());
	}

	//进行密码比对
	public boolean matches(CharSequence charSequence, String encodedPassword) {
		return encodedPassword.equals(MD5.encrypt(charSequence.toString()));
	}

}